const db=uniCloud.database();
const dbCmd = db.command;
module.exports = {
	_before: function () { // 通用预处理器

	},
	
		
	async addBuyRecord(user_id,snack_id,order_id){
           let res=await db.collection("buyRecord").add({
			   user_id,
			   snack_id,
			   order_id,
			   buyTime:Date.now()
		   });
	},
	async getBuyRecord(snack_id){
		let res= await db.collection("buyRecord").where({
			snack_id
		}).get();
		return res;
	}
}
